import socket
import ssl #01sl88blzoyiwa8bfv8nsdrb4iymkf


class IRC:

    def __del__(self):
        self._socket.close()

    def __init__(self, username, token):
        self._username = username
        self._token = token
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        host = 'irc.chat.twitch.tv'
        context = ssl.create_default_context()
        s.connect((host, 6697))
        self._socket = context.wrap_socket(s, server_hostname=host)

    def login(self):
        self._socket.send("PASS oauth:{0}\nNICK {1}\n".format(self._token, self._username).encode('utf8'))
        data = self._socket.recv(2400)
        test = True
